﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PowerWaveAddin.UserControls
{
	public partial class PicasaConfigControl : UploadConfigControl
	{
		public PicasaConfigControl() : base() { InitializeComponent(); }

		private void PicassaConfigControl_Load(object sender, EventArgs e)
		{
			this.userTextBox.Focus();
			userTextBox.Text = UploadConfigData.Instance.Picasa_Username;
			pwdTextBox.Text = UploadConfigData.Instance.Picasa_UnsavedPassword = UploadConfigData.Instance.Picasa_Password;
			savePwdCheckBox.Checked = !String.IsNullOrEmpty(UploadConfigData.Instance.Picasa_Password);
		}

		private void OnOkClick(object sender, EventArgs e)
		{
			UploadConfigData.Instance.Picasa_Username = userTextBox.Text;
			if (savePwdCheckBox.Checked)
				UploadConfigData.Instance.Picasa_Password = pwdTextBox.Text;
			else
				UploadConfigData.Instance.Picasa_Password = null;
			UploadConfigData.Instance.Picasa_UnsavedPassword = pwdTextBox.Text;
			UploadConfigData.Instance.SaveConfiguration();
			RaiseUploadConfigOk(e);
		}

		private void OnCancelClick(object sender, EventArgs e)
		{
			RaiseUploadConfigCancel(e);
		}
	}
}
